package com.mercury.ec.framework.air.core.client.impl.sunstn.jaxb.adapter;

import cn.hutool.core.util.StrUtil;

import javax.xml.bind.annotation.adapters.XmlAdapter;

/**
 * jaxb 字符串加冒号适配器
 *
 * @author hesx
 */
public class TimeAddColon2XmlAdapter extends XmlAdapter<String, String> {

    @Override
    public String unmarshal(String xml) throws Exception {
        if (StrUtil.isBlank(xml)) {
            return null;
        }
        return xml.substring(0, 2) + ":" + xml.substring(2);
    }

    @Override
    public String marshal(String time) throws Exception {
        // todo 暂无需求
        return time;
    }
}
